using UnityEngine;

namespace NodeCanvas.StateMachines
{
	[AddComponentMenu("")]
	[Name("Any State")]
	[Description("The Transitions of this node will constantly be checked. If any becomes true, the target connected State will Enter regardless of the current State. This node can have no incomming transitions.")]
	public class FSMAnyState : FSMState
	{
		public override string nodeName
		{
			get
			{
				return string.Format("<color=#b3ff7f>{0}</color>", base.nodeName.ToUpper());
			}
		}

		public override int maxInConnections
		{
			get
			{
				return 0;
			}
		}

		public override int maxOutConnections
		{
			get
			{
				return -1;
			}
		}

		public override bool allowAsPrime
		{
			get
			{
				return false;
			}
		}

		public void UpdateAnyState()
		{
			if (base.outConnections.Count == 0)
			{
				return;
			}
			base.status = Status.Running;
			for (int i = 0; i < base.outConnections.Count; i++)
			{
				FSMConnection fSMConnection = base.outConnections[i] as FSMConnection;
				if (!(fSMConnection.condition == null) && fSMConnection.CheckCondition(base.graphAgent, base.graphBlackboard))
				{
					base.FSM.EnterState(fSMConnection.targetNode as FSMState);
					break;
				}
			}
		}
	}
}
